package com.api.regression.group.creategroup;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class CreateGroupNotCreator extends AbstractApiTest {

	@Value("#{editgroups['user.notGroupCreator'].appId}")
	private String userUrn;

	@Value("#{editgroups['user.notGroupCreator'].password}")
	private String userPassword;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testCreateGroup() throws ZyncroApiException {

		String name = "New Group";
		String description = null;
		boolean isOpen = false;
		boolean isNewMemberEditor = false;
		boolean isNewMemberTaskManager = false;
		boolean isNewMemberInviter = false;
		boolean isNewMemberOwner = false;
		boolean isNewMemberComment = false;
		boolean showMembers = false;
		String attributes = null;

		getApi().getService(IGroupApiService.class).createGroup(name, description, isOpen, isNewMemberEditor, isNewMemberTaskManager,
				isNewMemberInviter, isNewMemberOwner, isNewMemberComment, showMembers, attributes);
	}
}
